// Simcenter STAR-CCM+ macro: cellTempA1.java
// Written by Simcenter STAR-CCM+ 18.02.008
//创建体积平均报告，并添加报告读取，电芯的温度
package macro;

import java.util.*;

import star.common.*;
import star.base.neo.*;
import star.base.report.*;
import star.meshing.*;

public class Create_cellTemperatureA1 extends StarMacro {

  public void execute() {
    for (int i=1;i<=23; i++) {
      execute0(i);
    }
    
  }

  private void execute0(int i ) {

     Simulation simulation_0 =       getActiveSimulation();

    VolumeAverageReport volumeAverageReport_1 =       simulation_0.getReportManager().createReport(VolumeAverageReport.class);

    PrimitiveFieldFunction primitiveFieldFunction_0 =       ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("Temperature"));

    volumeAverageReport_1.setFieldFunction(primitiveFieldFunction_0);

    volumeAverageReport_1.getParts().setQuery(null);

    Region region_55 =       simulation_0.getRegionManager().getRegion("C.cell "+i);

    volumeAverageReport_1.getParts().setObjects(region_55);

    Units units_4 =       ((Units) simulation_0.getUnitsManager().getObject("C"));

    volumeAverageReport_1.setUnits(units_4);

    volumeAverageReport_1.setPresentationName("cellTemperature A"+i);

  }
}

